import request from '@/utils/request'

export default {
    /**
     * 根据课程id查询该课程的课程大纲
     * @param {课程id} courseId 
     * @returns 
     */
    getChapterListByCourseId(courseId) {
        return request({
            url: `/eduservice/chapter/getChapterList/${courseId}`,
            method: 'get'
          })
    },
    /**
     * 添加课程章节
     * @param {添加章节对象} chpater 
     */
    addChapter(chapter) {
        return request({
            url: '/eduservice/chapter/addChapter',
            method: 'post',
            data: chapter
          })
    },
    /**
     * 根据章节id查询章节信息
     * @param {章节id} chapterId 
     */
    getChapterById(chapterId) {
        return request({
            url: `/eduservice/chapter/getChapterById/${chapterId}`,
            method: 'get'
          })
    },
    /**
     * 修改课程章节
     * @param {修改章节对象} chapter 
     */
    updateChapter(chapter) {
        return request({
            url: '/eduservice/chapter/updateChapter',
            method: 'post',
            data: chapter
          })
    },
    /**
     * 删除课程章节
     * @param {章节id} chapterId 
     */
    deleteChapter(chapterId) {
        return request({
            url: `/eduservice/chapter/remove/${chapterId}`,
            method: 'delete'
          })
    }
}
